﻿using DotNetty.Transport.Channels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace socketAssist.Handler
{
    public class ClientHandler : ChannelHandlerAdapter
    {
        public Action<string> OnRecievied;
        public ClientHandler()
        {
        }
        public override void ChannelActive(IChannelHandlerContext context)
        {
            base.ChannelActive(context);
        }
        public override void ChannelInactive(IChannelHandlerContext context)
        {
            base.ChannelInactive(context);
        }
        public override void ChannelRead(IChannelHandlerContext context, object message)
        {
            if (message == null)
            {
                return;
            }
            base.ChannelRead(context, message);
            if (OnRecievied != null)
            {
                OnRecievied((string)message);
            }
        }
    }
}
